using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace GSNConf.Rules.ConfigControls
{
    public partial class AllowedTimeRuleConfigControl : UserControl
    {
        public AllowedTimeRuleConfigControl()
        {
            InitializeComponent();
        }

        private void txtFrom_Validating(object sender, CancelEventArgs e)
        {
            TimeSpan t = TimeSpan.Zero;
            if (!TimeSpan.TryParse(txtFrom.Text, out t))
            {
                MessageBox.Show("From Hour is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Cancel = true;
                //txtFrom.Focus();
            }
        }

        private void txtTo_Validating(object sender, CancelEventArgs e)
        {
            TimeSpan t = TimeSpan.Zero;
            if (!TimeSpan.TryParse(txtTo.Text, out t))
            {
                MessageBox.Show("To Hour is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Cancel = true;
                //txtTo.Focus();
            }
        }
    }
}
